﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using BUS;

namespace GUI
{
    public partial class uc_TimKiemKH : DevExpress.XtraEditors.XtraUserControl
    {
        public uc_TimKiemKH()
        {
            InitializeComponent();
        }
        CustomerBL cus = new CustomerBL();
        private void btnTimKiem_Click(object sender, EventArgs e)
        {
            if (txtNoiDungTK.Text != "")
            {

                if (radioGroup1.SelectedIndex == 0)
                {
                    gridKhachHang.DataSource = cus.Customer_SelectCustomerWithBillByName(txtNoiDungTK.Text);
                }
                else if (radioGroup1.SelectedIndex == 1)
                {
                    gridKhachHang.DataSource = cus.Customer_SelectCustomerWithBillByID(int.Parse(txtNoiDungTK.Text));
                }
                else if (radioGroup1.SelectedIndex == 2)
                {
                    gridKhachHang.DataSource = cus.Customer_SelectCustomerWithBillByBillID(int.Parse(txtNoiDungTK.Text));
                }
            }
        }

        private void txtNoiDungTK_KeyPress(object sender, KeyPressEventArgs e)
        {
            if ((Keys)e.KeyChar == Keys.Enter)
                btnTimKiem_Click(null, null);
        }

 
    }
}
